package com.wenhao.newcode.iqiyi;

import javax.swing.*;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-08-01 14:58
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        String str = input.substring(1,input.length() - 1);
        String[] array = str.split(",");
        int[] rains = new int[array.length];
        for (int i = 0;i < array.length;i++) {
            rains[i] = Integer.parseInt(array[i]);
        }
        int[] ans = new int[rains.length];
        Map<Integer,Integer> pool = new HashMap<>();
        LinkedList<Integer> queue = new LinkedList<>();
        for (int i = 0;i < rains.length;i++) {
            if (rains[i] != 0) {
                queue.add(rains[i]);
            }
        }
        for (int i = 0;i < ans.length;i++) {
            if (rains[i] != 0) {
                if (pool.containsKey(rains[i])) {
                    if (pool.get(rains[i]) == 1) {
                        System.out.println("[]");
                        return;
                    } else {
                        pool.put(rains[i],1);
                    }
                } else {
                    pool.put(rains[i],1);
                }
                ans[i] = -1;
                queue.poll();
            } else {
                pool.put(queue.peek(),0);
                ans[i] = queue.poll();
            }
        }
        System.out.print("[");
        for (int i = 0;i < ans.length;i++) {
            if (i == ans.length - 1) {
                System.out.print(ans[i]);
            } else {
                System.out.print(ans[i] + ",");
            }
        }
        System.out.print("]");
    }
}
